package com.hbl.cgs.cgsagent.plugin;

import com.fasterxml.jackson.databind.JsonNode;
import org.apache.http.Consts;

import java.util.Map;

public class SingalEvent implements Event{
    private final Map<String, String> header;
    private final JsonNode message;

    public SingalEvent(Map<String, String> header, JsonNode message) {
        this.header = header;
        this.message = message;
    }

    public Map<String, String> getHeader() {
        if (header == null) {
            throw new NullPointerException();
        } else {
            return header;
        }
    }

    public byte[] getBody() {
        if (message == null) {
            return new byte[0];
        }
        return message.toString().getBytes(Consts.UTF_8);

    }
}
